import request from '@/utils/request'

export function getRolesList(params){
    return request({
        url:'/sys/role',
        method:'get',
        params
    })
}

export function addRolesList(data){
    return request({
        url:'/sys/role',
        method:'post',
        data
    })
}

export function updateRolesList(data){
    return request({
        url:`/sys/role/${data.id}`,
        method:'put',
        data
    })
}

// 删除角色
export function delRolesList(id){
    return request({
        url:`/sys/role/${id}`,
        method:'delete',
        data
    })
}

// 获取所有角色信息
export function getRoles(params){
    return request({
        url:'/sys/role',
        method:'GET',
        params:params
    })
}

// 获取角色详情
export function getRolesDetail(id){
    return request({
        url:`/sys/role/${id}`,
        method:'GET'
    })
}

// 给角色分配权限

export function assignPerm(data){
    return request({
        url:'/sys/role/assignPrem',
        method:'put',
        data
    })
}